package com.xbongbong.workflow.pojo.nodes;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @author 吴峰
 * @date 2021/05/24 19:56
 */
@Getter
@Setter
@ToString
public class WorkflowConditionPojo implements Serializable {
    private static final long serialVersionUID = -5283117691718772647L;
    /**
     * 字段类型
     */
    @NotNull(message = "{dto.msg.fieldType.NotNull}")
    private Integer fieldType;
    /**
     * 字段对应的标题
     */
    private String name;
    /**
     * 字段标识
     */
    @NotEmpty(message = "{dto.msg.attr.NotEmpty}")
    private String attr;
    /**
     * 节点id
     */
    private Long workflowNodeId;
    /**
     * 节点对应的表单id
     */
    @NotNull(message = "{dto.msg.formId.NotNull}")
    private Long formId;
    /**
     * 节点对应的表单的saasMark
     */
    @NotNull(message = "{dto.msg.saasMark.NotNull}")
    private Integer saasMark;
    /**
     * 节点对应的表单的业务类型
     */
    @NotNull(message = "{dto.msg.businessType.NotNull}")
    private Integer businessType;
    /**
     * 字段是否是触发节点字段的标识，0:不是；1:是
     *
     */
    @NotNull(message = "{dto.msg.triggerNodeFlag.NotNull}")
    private Integer triggerNodeFlag;

    /**
     * @see com.xbongbong.paas.enums.ConditionEnum
     */
    @NotNull(message = "{dto.msg.symbol.NotEmpty}")
    private String symbol;

    /**
     * 目标节点id，即右边的那个数据来源
     */
    private Long targetWorkflowNodeId;

    /**
     * 目标节点id对应的表单id
     */
    private Long targetFormId;
    /**
     * 目标节点id对应的表单的saasMark
     */
    private Integer targetSaasMark;
    /**
     * 目标节点id对应的表单的业务类型
     */
    private Integer targetBusinessType;

    /**
     * 值类型，1表示动态值，2表示固定值
     * @see WorkflowValueTypeEnum
     */
    @NotNull(message = "值类型不能为空")
    private Integer valueType;
    /**
     * 目标节点id的表单字段类型
     */
    private Integer targetFieldType;

    /**
     * 目标节点id的表单字段标识
     */
    private String targetAttr;
    /**
     * 固定值类型的值
     */
    private List<Object> value;

    /**
     * 日期字段的显示类型
     */
    private String dateType;

    public WorkflowConditionPojo() {
    }

    public WorkflowConditionPojo(String name, Integer fieldType, String attr, Integer triggerNodeFlag, Long workflowNodeId, Long formId, Integer saasMark, Integer businessType,
                                 String symbol,  Long targetWorkflowNodeId, Long targetFormId, Integer targetSaasMark, Integer targetBusinessType,
                                 @NotNull(message = "值类型不能为空") Integer valueType, Integer targetFieldType, String targetAttr, List<Object> value) {
        this.name = name;
        this.fieldType = fieldType;
        this.attr = attr;
        this.triggerNodeFlag = triggerNodeFlag;
        this.workflowNodeId = workflowNodeId;
        this.formId = formId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.symbol = symbol;
        this.targetWorkflowNodeId = targetWorkflowNodeId;
        this.targetFormId = targetFormId;
        this.targetSaasMark = targetSaasMark;
        this.targetBusinessType = targetBusinessType;
        this.valueType = valueType;
        this.targetFieldType = targetFieldType;
        this.targetAttr = targetAttr;
        this.value = value;
    }

    public WorkflowConditionPojo(Integer fieldType, String attr, Integer triggerNodeFlag, Long workflowNodeId, Long formId, Integer saasMark, Integer businessType,
                                 String symbol, @NotNull(message = "值类型不能为空") Integer valueType,  List<Object> value) {
        this.fieldType = fieldType;
        this.attr = attr;
        this.triggerNodeFlag = triggerNodeFlag;
        this.workflowNodeId = workflowNodeId;
        this.formId = formId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.symbol = symbol;
        this.valueType = valueType;
        this.value = value;
    }
}
